home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / MPW IIGS SC / SC.020.DTS.Tools.Libs / pixMapTool.usage < prev    next >
Encoding:
Text File  |  1990-06-24  |  3.0 KB  |  79 lines  |  [TEXT/MPS ]

  1. * pixelMap2Rgn
  2. * Copyright (C) 1989-1990 by Apple Computer
  3. *   -- written by Eric Soldan
  4. *
  5. * pixelMap2Rgn is proprietary Apple code.  To use this routine in a
  6. * commercial application, you must obtain redistribution rights from
  7. * Apple Software Licensing:
  8. *
  9. *     Apple Software Licensing
  10. *     Apple Computer, Inc.
  11. *     20525 Mariani Avenue, M/S 38-I
  12. *     Cupertino, CA 95014
  13. *     (408) 974-4667
  14. *     AppleLink:  SW.LICENSE
  15. *
  16. *
  17. * Code has been written to convert a pixelmap into a region.  This is
  18. * useful for a variety of things.  The most typical example is a
  19. * lasso command in a paint program.  This is even easier than before,
  20. * given the new functions SeedFill and CalcMask in 5.0.
  21. * Using these new 5.0 functions, you can generate a pixelmap of the
  22. * lassoed area.  Now, by using pixelMap2Rgn, you can convert this
  23. * pixel map into a region that you then can use in various ways.
  24. *
  25. * One thing that you might want to do with this region is:
  26. *   1) Copy it.
  27. *   2) InsetRgn one of the copies.
  28. *   3) Do a DiffRgn of these two regions.
  29. * Now you have a region that is the border of the lassoed area.  This
  30. * region can now be used to "shimmer" the border of the lassoed area,
  31. * just like MacPaint does.  It also can be used to determine if the
  32. * mouse has been moved over the lassoed area by using PtInRgn.
  33. * Basically, being able to convert a pixelmap into a region gives you
  34. * all the QuickDraw capabilities of any other region.  The
  35. * possibilities are numerous.
  36.  
  37. *******************************************************************************
  38.  
  39. * How to use pixelMap2Rgn from assembly:
  40.  
  41. * Input:
  42. *      long:  Pointer to a locInfo structure for the pixelmap.
  43. *             The pixelmap must be locked down, if it is in a handle.
  44. *      word:  Value indicating 2-bit or 4-bit pixels (2 or 4 passed).
  45. *             This is independent of 320 or 640 mode.  This way, we
  46. *             can handle dithered or non-dithered palettes.
  47. *             320 or 640 mode is determined by the SCB in the locInfo
  48. *             for the bitmap.
  49. *      word:  color table indicating which colors to include.
  50. *             bit 0 set:  include color 0 in region.
  51. *             bit 1 set:  include color 1 in region.
  52. *             .
  53. *             .
  54. *             .
  55. *             (For 2-bit colors, only bits 0 thru 3 are used)
  56. * Output:
  57. *      This function returns a region containing the relavent pixels.
  58. *      This is true only if:
  59. *           1)  The region does not exceed 65535 bytes.
  60. *           2)  There was enough memory to construct the region.
  61. *      Possible errors:
  62. *           1)  Region too complex.
  63. *           2)  Out-of-memory.
  64. *
  65. ***********************************************************************
  66.  
  67.  
  68.  
  69. * How to use pixelMap2Rgn from C:
  70.  
  71. * rgn = pixelMap2Rgn(locInfoPtr, mode, whichColors);
  72. *  locInfoPtr:  pixelmap to convert
  73. *        mode:  2-bit pixels or 4-bit pixels (2 or 4 passed)
  74. * whichColors:  16 bits of data indicating which colors to include
  75. *
  76. * If the pixelmap is in a handle, make sure the handle is locked
  77. * before calling pixelMap2rgn.
  78.  
  79.